import request from '@/router/axios';

// 查询配置列表
export function listSetting(query) {
  return request({
    url: '/config/manager/system/setting/list',
    method: 'get',
    params: query,
  });
}

// 系统设置
export function getSetting(key) {
  return request({
    url: `/shop-base/base/system/setting/get/${key}`,
    method: 'get',
  });
}

// 更新系统配置
export function setSetting(key, params) {
  return request({
    url: `/shop-base/base/system/setting/put/${key}`,
    method: 'put',
    data: params,
  });
}

// 新增配置
export function addSetting(data) {
  return request({
    url: '/config/manager/system/setting',
    method: 'post',
    data: data,
  });
}

// 修改配置
export function updateSetting(data) {
  return request({
    url: '/config/manager/system/setting/put',
    method: 'put',
    data: data,
  });
}

// 删除配置
export function delSetting(bid) {
  return request({
    url: '/config/manager/system/setting/' + bid,
    method: 'delete',
  });
}

/*
 * 获取 支付支持设置开关
 */
export function getPaymentSupportForm() {
  return request({
    // url: `/config/manager/system/settingx/paymentSupport`,
    url: '/shop-base/base/system/settingx/paymentSupport',
    method: 'get',
  });
}

/*
 * 获取 小程序配置是否开启
 */
export function getWxMenuShow() {
  return request({
    url: `/system/applet/menu/visible`,
    method: 'get',
  });
}

/*
 * 获取 小程序目录配置
 */
export function getWxMenu() {
  return request({
    url: `/system/applet/menu/list`,
    method: 'get',
  });
}
/*
 * 更新 小程序目录配置
 */
export function updateMenu(params) {
  return request({
    url: `/system/applet/menu`,
    method: 'put',
    data: params,
  });
}
